package com.midian.common.init;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.apache.log4j.Logger;

import com.midian.common.system.SysStatic;

/**
 * 
 * @Title:初始化 
 * @Desription:web系统初始化，初始化前台系统所需的常量，放入Application中
 * @Company:MDKG
 * @ClassName:InitServlet.java
 * @Author:zhucong
 * @CreateDate:2013-6-7 下午5:57:06  
 * @UpdateUser:zhucong  
 * @Version:0.1
 */
public class InitServlet extends HttpServlet{
	
	private static final long serialVersionUID = -6541168966552938103L;
	
	private static final Logger LOG = Logger.getLogger(InitServlet.class);
	
	@Override
	public void init(ServletConfig config) throws ServletException {
		ServletContext sc = config.getServletContext();
		//设置项目根目录到Application作用域
		String path = sc.getContextPath();
		//设置项目根目录到全局变量中
		SysStatic.webRootPath = path;
		sc.setAttribute("path", SysStatic.webRootPath);
	}
}
